package com.krain.ddbb.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.krain.ddbb.R;
import com.krain.ddbb.entity.WorkNameBean;

import java.util.List;

/**
 * Created by ex-kuangxiaomin101 on 2016-01-18.
 */
public class WorkItemAdapter extends BaseAdapter {

    private Context mContext;
    WorkNameBean[] String;

    public WorkItemAdapter(Context context,WorkNameBean[] string) {
        this.mContext = context;
        this.String = string;
    }

    @Override
    public int getCount() {
        return String.length;
    }

    @Override
    public Object getItem(int position) {
        return String[(position)];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater _LayoutInflater = LayoutInflater.from(mContext);
        convertView = _LayoutInflater.inflate(R.layout.item_work_type_spinner, null);
        if (convertView != null) {
            TextView mTvName = (TextView) convertView
                    .findViewById(R.id.item_work_type_text);
            mTvName.setText(String[(position)].getWork_name());
        }
        return convertView;
    }
}
